home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / comm / mebbs / callback.lha / callback / callback.rexx < prev    next >
OS/2 REXX Batch file  |  1994-06-14  |  9KB  |  348 lines

  1. /* Call Back Door by Larry Cloud - MEBBS #M3001 6/14/94 */
  2.  
  3. signal on ERROR
  4. parse arg LineNumber
  5. options results
  6. DoorName = "Call Back Door"
  7. author = "Larry Cloud"
  8. sysop="Keith Kittlesen"
  9. if( ~show( 'l', "mebbsarexx.library" ) )then do
  10.    if( ~addlib( "mebbsarexx.library", 0, -30, 0 ) )then do
  11.       say "Could not open library"
  12.       exit 10
  13.    end
  14. end
  15.  
  16. call GetVar DoorName,LineNumber,1
  17. username = result
  18. call GetVar Doorname,Linenumber,20
  19. access=result
  20. call GetVar DoorName,LineNumber,2
  21. password=result
  22. call GetVar DoorName,LineNumber,3
  23. address=result
  24. call GetVar DoorName,LineNumber,4
  25. city=result
  26. call GetVar DoorName,LineNumber,5
  27. state=result
  28. call GetVar DoorName,LineNumber,7
  29. telephone=result
  30.  
  31. sent=0
  32. badpw=0
  33. subject="Aborted" /* This will get changed if we actually DO something */
  34. if access < 1 then signal main
  35. subject="Already Validated"
  36. call blank
  37. string="You're already validated.  This door will do nothing for you now."
  38. call output
  39. call blank
  40. signal getout
  41.  
  42. main:
  43. string="Welcome to Larry's Call Back Validation Door, "username
  44. call output
  45. call blank
  46. string="You will be asked to enter the phone number that you wish this BBS to"
  47. call output
  48. string="call.  You will need to enter it on three separate lines:"
  49. call output
  50. call blank
  51. string="Line 1: Area Code (Western Washington is 206)."
  52. call output
  53. string="Line 2: Prefix (the prefix here at Kitt's Korner is 698)."
  54. call output
  55. string="Line 3: The Suffix (the suffix here at Kitt's Korner is 0515)."
  56. call output
  57. call blank
  58. string="The BBS will then determine if it can call you back.  If it can't, it"
  59. call output
  60. string="will inform you so, and your account will have to be updated manually."
  61. call output
  62. string="Don't worry, I'll inform the sysop via E-Mail if thats the case."
  63. call output
  64. call blank
  65. string="Next, if it IS feasible to call you back, you will experience a dropped"
  66. call output
  67. string="carrier.  As soon as that happens, type the letters ATA on your keyboard."
  68. call output
  69. string="as SOON as your phone rings, hit your ENTER key.  By doing so, you've"
  70. call output
  71. string="told your modem to AUTOANSWER.  Once our modems negotiate the connection,"
  72. call output
  73. string="you will be asked to enter your name.  Once you do this, you will be asked"
  74. call output
  75. string="to enter your password.  If you do both of these right, your access level"
  76. call output
  77. string="will be raised to that of a normal user.  The sysop will be informed,"
  78. call output
  79. string="either way, of the outcome of this transaction."
  80. call output
  81. call blank
  82. string="Press return..."
  83. call getkey
  84. call blank
  85. string="Next, you will be sent a file called "ALLFILES.TXT", which is an up-to-date"
  86. call output
  87. string="listing of all of the downloadable files on this BBS, as of midnight this"
  88. call output
  89. string="date.  Once all of that is done, you will be credited an additional fifteen"
  90. call output
  91. string="minutes, to do with as you please."
  92. call output
  93. call blank
  94. string="If, for some reason, the BBS doesn't call you right back, you'll need to"
  95. call output
  96. string="run this program again, unless the sysop manually validates you before you"
  97. call output
  98. string="get the chance to run it again.  OK, here we go..."
  99. call output
  100. call blank
  101. string="Press return..."
  102. call getkey
  103.  
  104. getareacode:
  105. call blank
  106. string="Please enter your area code (Press Q for QUIT or press enter for 206):"
  107. length=4
  108. call input
  109. if typed="" then typed="206"
  110. if upper(typed)="Q" then signal getout
  111. if datatype(typed) ~="NUM" then signal getareacode
  112. if length(typed) ~=3 then signal getareacode
  113. call checkvalidareacode
  114. if badarea=1 then signal getareacode
  115. areacode=typed
  116.  
  117. getprefix:
  118. call blank
  119. string="Please enter your three digit prefix:"
  120. length=4
  121. call input
  122. if typed="" then signal getprefix
  123. if datatype(typed) ~="NUM" then signal getprefix
  124. if length(typed) ~=3 then signal getprefix
  125. call checkvalidprefix
  126. call blank
  127. prefix=typed
  128.  
  129. getsuffix:
  130. call blank
  131. string="Please enter your four digit suffix:"
  132. length=5
  133. call input
  134. if typed="" then signal getsuffix
  135. if datatype(typed) ~="NUM" then signal getsuffix
  136. if length(typed) ~=4 then signal getsuffix
  137. call blank
  138. call blank
  139. suffix=typed
  140.  
  141. string="You have entered: "areacode"-"prefix"-"suffix" for your number.  Is this"
  142. call output
  143. string="correct? (Y/n) "
  144. call getkey
  145. if upper(hot)="N" then signal getareacode
  146. string="Yes"
  147. call output
  148. call blank
  149. string="OK, I'm about to call you back.   Remember, as soon as the carrier drops,"
  150. call output
  151. string="type ATA, and when your phone rings, hit Enter."
  152. call output
  153. call blank
  154. string="Press any key to drop carrier and initiate callback..."
  155. call getkey
  156. call blank
  157. phonenumber=prefix||suffix
  158. call callback
  159. call blank
  160. string="Hi, this is Kitt's Korner BBS, performing a call-back verification for"
  161. call output
  162. string=username
  163. call output
  164. string=address
  165. call output
  166. string=city||", "||state
  167. call output
  168.  
  169. getpassword:
  170. call blank
  171. call blank
  172. string="Please enter your password that you originally logged onto this BBS with."
  173. call output
  174. string=""
  175. length=18
  176. call input
  177. typed=upper(typed)
  178. if password=typed then signal goodpassword
  179. badpw=badpw+1
  180. call blank
  181. string="That is incorrect."
  182. call output
  183. if badpw=3 then do
  184.  string="one more chance..."
  185.  call output
  186. end
  187. if badpw < 4 then signal getpassword
  188. call blank
  189. string="Sorry, that is not the password that you originally entered.  The sysop"
  190. call output
  191. string="has been notified.  Your access level will remain at access level 0."
  192. call output
  193. call blank
  194. subject="Bad Password"
  195. call informsysop
  196. signal getout
  197.  
  198. informsysop:
  199. string = "E-Mail"
  200. stype=1
  201. call getmbnum
  202. answer=result
  203. if answer = -1 then signal error /* Doesn't exist! */
  204. to=sysop
  205. from="Larrys Callback Door"
  206. BaseNo = answer
  207. bodypath="doors:callback/aborted.txt"
  208. if subject="Bad Password" then bodypath="doors:callback/badpw.txt"
  209. if subject="Success" then bodypath="doors:callback/success.txt"
  210. if subject="Already Validated" then bodypath="doors:callback/already.txt"
  211. subject=username
  212. Attach = "0"
  213. Private = "1"
  214. Pound = "#"
  215. InfoString = From||Pound||To||Pound||Subject||Pound||BodyPath||Pound||BaseNo||Pound||Attach||Pound||Private
  216. call RobotMessage DoorName,InfoString
  217. if upper(result)="ABORTED" then signal error
  218. sent=1
  219. return
  220.  
  221. goodpassword:
  222. string="See, that wasn't so hard.  Your access level has been changed to access"
  223. call output
  224. string="level two, normal user access.  The sysop has been informed of the success."
  225. call output
  226. call changelevel doorname,linenumber,2
  227. subject="Success"
  228. call informsysop
  229. string="Now, I'll send you the ALLFILES.TXT file, a listing of all the downloable"
  230. call output
  231. string="files on this BBS.  This list was accurate as of 12:01am this morning."
  232. call output
  233. call sendbinfile doorname,linenumber,"dh1:mebbs/files/gtext/allfiles.txt"
  234. call blank
  235. string="Almost done.  For being such a good sport and using this door, I'm crediting"
  236. call output
  237. string="you with 30 extra minutes for this call."
  238. call output
  239. minutes=30
  240. call addtime
  241. string="If you don't plan on using this extra time, you should deposit it into the"
  242. call output
  243. string="time bank door for future use."
  244. call output
  245. call blank
  246. signal getout
  247.  
  248.  
  249. checkvalidareacode:
  250. if typed ~="206" then do
  251.  call blank
  252.  string="Sorry, this program is not configured to handle out of state calls."
  253.  call output
  254.  call blank
  255.  string="Press return..."
  256.  call getkey
  257.  signal getout
  258. end
  259. return
  260.  
  261. checkvalidprefix:
  262. if exists("doors:callback/prefix") then do
  263.  call open(file,"doors:callback/prefix", 'R')
  264.  do until eof(file)
  265.   pre=readln(file)
  266.   if typed=pre then goodprefix=1
  267.  end
  268.  call close(file)
  269.  if goodprefix~=1 then do
  270.   call blank
  271.   string="Sorry, this program is not configured to handle out of area calls."
  272.   call output
  273.   call blank
  274.   string="Press return..."
  275.   call getkey
  276.   signal getout
  277.  end
  278. end
  279. return
  280.  
  281. callback:
  282. call dropandcall doorname,linenumber,phonenumber
  283. success=upper(result)
  284. if success="CONNECT" then return
  285. signal error
  286.  
  287. GETKEY:
  288. call hotkey doorname,linenumber,string
  289. hot=result
  290. call carrier
  291. return
  292.  
  293. INPUT:
  294. call prompt doorname,linenumber,string,length
  295. typed=result
  296. if upper(typed)="NULL" then typed=""
  297. call carrier
  298. return
  299.  
  300. OUTPUT:
  301. call message doorname,linenumber,string,1
  302. return
  303.  
  304. MSG:
  305. call message doorname,linenumber,string,0
  306. return
  307.  
  308. BLANK:
  309. string = " "
  310. call output
  311. return
  312.  
  313. GETOUT:
  314. if sent ~=1 then call informsysop
  315. call blank
  316. string = "You've been using "||doorname||" by "||author||"."
  317. call output
  318. call blank
  319. string = "Thank you, "||username||", please press [RETURN] or [ENTER]."
  320. call getkey
  321. call blank
  322. call Exit_Door DoorName,LineNumber
  323. exit 0
  324.  
  325. ERROR:
  326. call Exit_Door DoorName,LineNumber
  327. exit 0
  328.  
  329. AddTime:
  330. call AddUserTime doorname,linenumber,minutes
  331. return
  332.  
  333. Carrier:
  334. call CDetect doorname,linenumber
  335. cd=upper(result)
  336. if cd="NO CARRIER!" then signal error
  337. return
  338.  
  339. GetMBNum:
  340. call GetMsgBaseNumber doorname,string,stype
  341. hot=result
  342. return
  343.  
  344. drophim:
  345. call HangUp doorname,linenumber
  346. exit 0
  347.  
  348.